<!-- HTML header for doxygen 1.9.7-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.13.2"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<title>libsir: The Standard Incident Reporter Library</title>
<!-- OpenGraph -->
<meta property="og:title" content="libsir: The Standard Incident Reporter Library">
<meta property="og:description" content="A lightweight, cross-platform C library for information distribution">
<meta property="og:url" content="https://libsir.rml.dev">
<meta property="og:type" content="website">
<meta property="og:image" content="https://libsir.rml.dev/res/libsir-og.png">
<meta name="twitter:card" content="summary_large_image"></meta>
<meta name="twitter:title" content="libsir: The Standard Incident Reporter Library"></meta>
<meta name="twitter:description" content="A lightweight, cross-platform C library for information distribution"></meta>
<meta name="twitter:image" content="https://libsir.rml.dev/res/libsir-og.png"></meta>
<!-- /OpenGraph -->
<!-- favicon -->
<link rel="icon" href="res/libsir-icon.png">
<link rel="icon" href="res/libsir-icon.svg" type="image/svg+xml">
<link rel="manifest" href="res/icons.webmanifest">
<!-- /favicon -->
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="cookie.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="stylesheet.css" rel="stylesheet" type="text/css" />
<link href="rml-navtree.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">libsir<span id="projectnumber">&#160;2.2.6</span>
   </div>
   <div id="projectbrief">Standard Incident Reporter</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.13.2 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() { codefold.init(0); });
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search',true);
  $(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function(){initNavTree('testsuite.html',''); initResizable(true); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>

<div><div class="header">
  <div class="headertitle"><div class="title">Test suite</div></div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p><a class="anchor" id="md_docs_2sources_2sirtests"></a></p>
<p>In order to ensure that libsir is working properly on your system, the first thing you should do after compilation is verify that the test suite runs successfully (<em>in fact, we recommend making it part of your deployment workflow</em>).</p>
<p>It will exit with <code>0</code> if all test(s) ran successfully and passed, or <code>1</code> if errors occurred/any test failed.</p>
<h1>Basic usage</h1>
<p>The simplest way to achieve this is simply to run <code>build/bin/sirtests</code> from the root of the repository. You should see output similar to the following:</p>
<div class="fragment"><div class="line">done: all 32 libsir tests passed in 5.085sec!</div>
</div><!-- fragment --><h1>Advanced usage</h1>
<p><code>sirtests</code> has a command-line interface that allows you to control its behavior. For the current options, run <code>sirtests --help</code>. You should see output similar to the following:</p>
<div class="fragment"><div class="line">Usage:</div>
<div class="line"> </div>
<div class="line">    --perf       Only run the performance measurement test</div>
<div class="line">    --only       name [, name, ...] Only run the test(s) specified</div>
<div class="line">    --list       Prints a list of available test names <span class="keywordflow">for</span> use with <span class="stringliteral">&#39;--only&#39;</span></div>
<div class="line">    --leave-logs Log files are not deleted so that they may be examined</div>
<div class="line">    --wait       After running test(s), waits <span class="keywordflow">for</span> a keypress before exiting</div>
<div class="line">    --version    Prints the version of libsir that the test suite was built with</div>
<div class="line">    --help       Shows <span class="keyword">this</span> message</div>
</div><!-- fragment --><p>Of note here is the obvious one, <code>--perf</code>. The perf test is only run if you explicitly specify this flag. It is a good way to ensure that libsir is compiled correctly for deployment in a production environment. If you get a very slow (<em>or dubiously fast</em>) result, you should re-examine your configuration.</p>
<p>The result includes a comparison to an equivalent raw <code>printf</code> call for the same number of iterations. I expect this to always be faster than libsir for many reasons, but I have seen it beaten once.</p>
<p>Here is an example of the results of <code>--perf</code> on this development machine (<em>iMac Pro, 3.2GHz 8-core Xeon, 64GB 2666MHz DDR4, SSD</em>):</p>
<div class="fragment"><div class="line">printf: 1000000 lines in 3.375sec (296296.3 lines/sec)</div>
<div class="line">libsir (stdout): 1000000 lines in 5.427sec (184263.9 lines/sec)</div>
<div class="line">libsir (file): 1000000 lines in 1.278sec (782472.6 lines/sec)</div>
<div class="line">timer resolution: ~1000nsec</div>
</div><!-- fragment --><hr  />
<dl class="section remark"><dt>Remarks</dt><dd>The perf test only outputs to the debug level. If level switching were introduced where formatting options varied from level to level, a much slower elapsed time could be expected, since some of libsir's internal formatting buffers would need to be recalculated each time.</dd></dl>
<p>The other useful flags include <code>--list</code> and <code>--only</code> if you wish to narrow down a problem test or set of tests. Please let us know if you think of additional tests that should be performed by <a href="https://github.com/aremmell/libsir/issues/new?template=Feature_request.md">opening a feature request</a>. </p>
</div></div><!-- contents -->
</div><!-- PageDoc -->
</div><!-- doc-content -->
<!-- HTML footer for doxygen 1.9.7-->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.13.2 </li>
  </ul>
</div>
</body>
</html>
